import Vue from 'vue'
import DataDict from '@/libs/dict'
import {
	getDicts as getDicts
} from '@/api/index'

function install() {

	Vue.use(DataDict, {
		metas: {
			'*': {
				labelField: 'dictLabel',
				labelEnField: 'dictLabelEn',
				valueField: 'dictValue',
				request(owner, dictMeta) {
					return getDicts(owner.$axios, dictMeta.type).then(res =>  res.data)
				},
			},
		},
	})
}

export default {
	install,
}
